package com.pds.web.testOrganization.controller;

import com.pds.common.core.controller.BaseController;
import com.pds.common.core.domain.R;
import com.pds.common.core.page.TableDataInfo;
import com.pds.web.testOrganization.domain.PdsTestOrganizationQualification;
import com.pds.web.testOrganization.service.IPdsTestOrganizationQualificationService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api
@RestController
@RequestMapping("/qualification")
public class PdsTestOrganizationQualificationController extends BaseController {

    @Autowired
    private IPdsTestOrganizationQualificationService pdsTestOrganizationQualificationService;

    /**
     * 新增
     *
     * @param pdsTestOrganizationQualification
     * @return
     */

    @PostMapping("/add")
    public R<PdsTestOrganizationQualification> add(@RequestBody PdsTestOrganizationQualification pdsTestOrganizationQualification) {

        return R.ok(pdsTestOrganizationQualificationService.addQualification(pdsTestOrganizationQualification));
    }

    /**
     * 删除 -- 根据ID
     *
     * @return
     */

    @DeleteMapping("/delete")
    public R<Boolean> delete(Long id) {
        return R.ok(pdsTestOrganizationQualificationService.deleteQualification(id));
    }

    /**
     * 更新
     * @param pdsTestOrganizationQualification
     * @return
     */

    @PutMapping("/update")
    public R<Boolean> update(@RequestBody PdsTestOrganizationQualification pdsTestOrganizationQualification){
        return R.ok(pdsTestOrganizationQualificationService.updateQualification(pdsTestOrganizationQualification));
    }

    /**
     * 查询
     * @param pdsTestOrganizationQualification
     * @return
     */

    @GetMapping("/list")
    public TableDataInfo list(PdsTestOrganizationQualification pdsTestOrganizationQualification){
        startPage();
        List<PdsTestOrganizationQualification> list = pdsTestOrganizationQualificationService.selectQualificationlist(pdsTestOrganizationQualification);
        return getDataTable(list);
    }
}
